from enum import Enum, Flag
import datetime
import sys
from PyCmpltrtok.common import sep


class Weekday(Flag):
    MONDAY = 2 ** 0
    TUESDAY = 2 ** 1
    WEDNESDAY = 2 ** 2
    THURSDAY = 2 ** 3
    FRIDAY = 2 ** 4
    SATURDAY = 2 ** 5
    SUNDAY = 2 ** 6


if __name__ == '__main__':

    mon = Weekday.MONDAY
    print('Monday', repr(mon))

    tue = Weekday(2)
    print('Tuesday', repr(tue))

    weekend = Weekday.SATURDAY | Weekday.SUNDAY
    print('Weekend', repr(weekend))

    sep('Iterate Flag object')
    if sys.version_info[:2] < (3, 11):
        print('Python 3.11 is a must!')
    else:
        print('Weekend', list(weekend))  # TypeError: 'Weekday' object is not iterable

        for i, day in enumerate(weekend):  # TypeError: 'Weekday' object is not iterable
            print(i, day)

        for day in weekend:  # TypeError: 'Weekday' object is not iterable
            print(day)

        print(list(Weekday.SUNDAY | Weekday.MONDAY | Weekday.THURSDAY))
